﻿using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace Mrc.Domain.Module.TaskCenter.IHostService.Default
{
    public class SystemRuntimeInfoHostService: BackgroundService
    {
        private readonly ILogger<SystemRuntimeInfoHostService> _logger;
 
        public SystemRuntimeInfoHostService(ILogger<SystemRuntimeInfoHostService> logger)
        {
          
        }

        protected override async Task ExecuteAsync(CancellationToken stoppingToken)
        {
            _logger.LogDebug($"GracePeriodManagerService is starting.");

            stoppingToken.Register(() => _logger.LogDebug($" GracePeriod background task is stopping."));

            while(!stoppingToken.IsCancellationRequested)
            {
                Console.WriteLine($"当前时间 {DateTime.Now}");
                await Task.Delay(1000, stoppingToken);
            }
            _logger.LogDebug($"GracePeriod background task is stopping.");
        }
    }
}
